// import appBackMainPage from '@/services/h5/app-api/appBackMainPage.js'
import appBackLastPage from '@/services/h5/app-api/appBackLastPage.js'
import { isApp } from '@/utils/platform'
export default {
  props: {
    goUrl: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      isApp
    }
  },
  methods: {
    judgeAppBack() {
      let goUrl = this.goUrl
      if (this.isApp) {
        //       0：返回首页
        // 1：返回产品主页面
        // 2：返回回放主页面
        // 3：返回我的主页面
        if (this.$route.meta && this.$route.meta.back) {
          if (this.$route.meta.back !== '-1') {
            // appBackMainPage({
            //   pageIndex: this.$route.meta.back
            // })
            appBackLastPage()
          } else {
            appBackLastPage()
          }
        } else {
          if (goUrl) {
            this.$router.push(goUrl)
          } else {
            this.$router.go(-1)
          }
        }
      } else {
        if (goUrl) {
          this.$router.push(goUrl)
          // window.location.replace(
          //   'http://localhost:8080/#/customerNotification?productId=1815'
          // )
        } else {
          this.$router.go(-1)
        }
      }
    }
  }
}
